/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package chapter6;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author Denise Carolina
 */
public class SelfTest2 extends Player implements Serializable{

    public SelfTest2() {
        System.out.println("selftest2");
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        FileOutputStream fos = null;
        try {
            SelfTest2 st = new SelfTest2();
            fos = new FileOutputStream("play.txt");
            ObjectOutputStream oos = new ObjectOutputStream(fos);
            oos.writeObject(st);
            oos.close();
            oos.flush();
            fos.close();

            FileInputStream fis = new FileInputStream("play.txt");
            ObjectInputStream ois = new ObjectInputStream(fis);
            ois.readObject();
            ois.close();
            fis.close();

        } catch (Exception ex) {
            Logger.getLogger(SelfTest2.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}

  class Player {
        Player (){System.out.println("player");}
    }